package com.huluobo.base.net

import com.huluobo.base.bean.AddToCartBeanResult
import com.huluobo.base.bean.BannerBeanResult
import com.huluobo.base.bean.CartBeanResult
import com.huluobo.base.bean.CategoryBeanResult
import com.huluobo.base.bean.CategoryGoodsListBeanResult
import com.huluobo.base.bean.ChangeCartBeanResult
import com.huluobo.base.bean.DetailBeanResult
import com.huluobo.base.bean.HomeGoodsBeanResult
import com.huluobo.base.bean.HomeNavBeanResult
import com.huluobo.base.bean.UserBeanResult
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

/**
 *  Created by LC on 2024/6/22.
 *  请求地址
 */
interface ApiService {
    @POST(Const.URL_LOGIN)
    fun login(@Body body: RequestBody): Observable<UserBeanResult>

    @POST(Const.URL_REGISTER)
    fun register(@Body body: RequestBody): Observable<UserBeanResult>

    @GET(Const.URL_HOME_GOODS_LIST)
    fun getHomeGoodsList(
        @Query(Const.PARAM_CATEGORY_ID) categoryId: Int,
        @Query(Const.PARAM_CURRENT_PAGE) currentPage: Int,
        @Query(Const.PARAM_PAGE_SIZE) pageSize: Int
    ): Observable<HomeGoodsBeanResult>

    @GET(Const.URL_HOME_BANNER)
    fun getHomeBanner(): Observable<BannerBeanResult>

    @GET(Const.URL_HOME_NAV)
    fun getHomeNav(): Observable<HomeNavBeanResult>

    @GET(Const.URL_DETAIL)
    fun getGoodsDetail(@Query(Const.PARAM_GOODS_ID) goodsId: Int): Observable<DetailBeanResult>

    @POST(Const.URL_ADD_TO_CART)
    fun addToCart(@Body body: RequestBody): Observable<AddToCartBeanResult>

    @GET(Const.URL_QUERY_CART)
    fun queryCart(): Observable<CartBeanResult>

    @GET(Const.URL_CATEGORY_LIST)
    fun getCategoryList(): Observable<CategoryBeanResult>

    @GET(Const.URL_CATEGORY_GOODS_LIST)
    fun getCategoryGoodsList(
        @Query(Const.PARAM_CATEGORY_ID) categoryId: Int,
        @Query(Const.PARAM_CURRENT_PAGE) currentPage: Int,
        @Query(Const.PARAM_PAGE_SIZE) pageSize: Int
    ): Observable<CategoryGoodsListBeanResult>

    @POST(Const.URL_DELETE_CART)
    fun deleteCart(@Body body: RequestBody): Observable<ChangeCartBeanResult>

    @POST(Const.URL_ADD_TO_CART)
    fun changeCartCount(@Body body: RequestBody): Observable<ChangeCartBeanResult>
}